package com.yjb.demo.tdengine.controller;

import com.yjb.demo.tdengine.domain.entity.Meters;
import com.yjb.demo.tdengine.domain.form.MetersForm;
import com.yjb.demo.tdengine.service.MetersService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author yinjinbiao
 * @create 2024/6/3 14:22
 */
@RestController
@RequestMapping("/meters")
public class MetersController {

    @Resource
    private MetersService metersService;

    /**
     * 获取列表
     * @return
     */
    @GetMapping("/list")
    public List getMeters(){
        List<Meters> list = metersService.list();
        return list;
    }

    /**
     * 新增采集数据
     * @param metersForm
     */
    @PostMapping("/add")
    public void add(@RequestBody MetersForm metersForm){
        metersService.add(metersForm);
    }

    @GetMapping("/getRealTimeData")
    public Object getRealTimeData(){
        Object object = metersService.getRealTimeData();
        return object;
    }
}
